<?php


class DB_USER extends ORM_Table {
    static protected $table_name = 'user';
    
    static public function getTableName($params = null) {
        //$table_name = self::$table_name.substr($params['article_type_id'], 0, 1);
        return self::$table_name;
    }

    /**
     * 检测用户是否存在
     * @param <String> $email
     * @return <type>
     */
    static function hasEmail($email) {
        $has    = DAO_Finder::findOne(DB_USER, "email='$email'");
        return $has;
    }

    static function userLogin($email, $password) {
        $user   = DAO_Finder::findOne(DB_USER, array('email' => $email));

        if(empty($user)){
           return false;
        }

        if($user && $user->getPassword()==''.$password.''){
            return $user;
        }else{
            return false;
        }
    }
}

